$(document).ready(function(){
	App.init();
	var flag=true;
	var grid01 = $('#grid01').dataTable({
		"bFilter" : false,
		"sServerMethod" : "POST",
		"bServerSide" : true,
		"bSort" : false,
		"bProcessing" : true,
		"aLengthMenu" : [[ 10, 20, 30, 50, 100],[ 10, 20, 30, 50, 100]],
		"sPaginationType" : "bootstrap",
		"oLanguage" : datatablecn,
		"fnServerParams" : function(aoData) {			
			var arr = $("#queryInfoForm").serializeArray();
			for(var i=0;i<arr.length;i++){
				aoData.push(arr[i]);
			}						
		},
		"sAjaxSource" : '../baseinformationMaintenance/ajaxList1.json',
		"aoColumnDefs" : [
				{
					aTargets : ['_all'],
					sDefaultContent : '',
					"bSortable" : false,
					"bSearchable" : false
				},{
					'aTargets' : [0],
					"mData" : "id",
					"mRender" : function(data, type, full) {
						var id=full.id;
						if(typeof(id)== 'undefined'){
							id='';
						}
						return id;
					}
				},{
					'aTargets' : [1],
					"mData" : "serviceNo",
					"mRender" : function(data, type, full) {
						var id=full.serviceNo;
						if(typeof(serviceNo)== 'undefined'){
							serviceNo='';
						}
						return serviceNo;
					}
					
				},{
					'aTargets' : [2],
					"mData" : "serviceName",
					"mRender" : function(data, type, full) {
//						var url = cscBasePath+"/store/edit.htm?partnerId="+ data;
//						return '<a style="text-decoration:underline;padding-bottom:8px;border-bottom:1 solid black;"href="'+url+'" target="_blank">'+data+'</a>';						
					    return data;
					}
				},{
					'aTargets' : [3],
					"mData" : "serviceCtgName"
				},{
					'aTargets' : [4],
					"mData" : "serviceType"
				},
				{
					'aTargets' : [5],
					"mData" : "workTime"
				},
				{
					'aTargets' : [6],
					"mData" : "status",
					"mRender" : function(data, type, full) {                             	  
    					    return data;                       
					}
				}]
	});
	$('#queryInfo').click(function(){
    	//var createbegin=$('#createTimeQueryStart').val();
    	//var createend=$('#createTimeQueryEnd').val();
    	//var updatebegin=$('#updateTimeQueryStart').val();
    	//var updateend=$('#updateTimeQueryEnd').val();
    	//var createFlag=(createbegin == '' && createend != '') || (createbegin != '' && createend == '');
    	//var updateFlag=(updatebegin == '' && updateend != '') || (updatebegin != '' && updateend == '');
    	//if(createFlag){
    		//$.dopAlert("请将日期选择完整!", null);
    		//return false;
    	//}else if(updateFlag){
    	//	$.dopAlert("请将日期选择完整!", null);
    	//	return false;
    	//}else{
    		grid01.fnSettings()._iDisplayStart = 0;
    		grid01.fnDraw();
    	//}
    	
    });
	
	$("#queryInfoForm").validate({
		submitHandler: function(form) {
			grid01.fnSettings()._iDisplayStart = 0;;
			grid01.fnDraw();
			return false;
		}
	});
		
		
});